﻿/**
 * 获取url参数
 * */
function GetQueryStringArgs() {
    //取得查询字符串并去掉开头问好
    var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
        //保存数据对象
        args = {},
        //取得第一项
        items = qs.length ? qs.split("&") : [],
        item = null,
        name = null,
        value = null,
        //在for循环中使用
        i = 0,
        len = items.length;

    //逐个将每一项添加到arags对象中
    for (i = 0; i < len; i++) {
        item = items[i].split("=");
        name = decodeURIComponent(item[0]);
        value = decodeURIComponent(item[1]);
        if (name.length) {
            args[name] = value;
        }
    }
        
    return args;
}

function CurrentDate () {
    var date = new Date();
    var sep1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var day = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (day >= 0 && day <= 9) {
        day = "0" + day;
    }
    return year + sep1 + month + sep1 + day;
};

//diffDay :加或者减去当日 天数的天数
 function DefineDate (diffDay) {
    var date = new Date()
    var day = date.getDate()

    if (typeof diffDay != "undefined" && typeof diffDay == "number") {
        date.setDate(day + diffDay);
    }

    var sep1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    day = date.getDate();

    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (day >= 0 && day <= 9) {
        day = "0" + day;
    }
    return year + sep1 + month + sep1 + day;
};

function saveToken(token) {

}